package com.xl.interfacedemo;

import java.util.ArrayList;

public class ClassManager {

    private ArrayList<Student> studentList = new ArrayList<>();
    //private StudentOperator studentOperator = new StudentOperatorImpl1();
    private StudentOperator studentOperator = new StudentOperatorImpl2();

    public ClassManager() {
        Student student1 = new Student("张三", '男', 99.0);
        Student student2 = new Student("李四", '女', 98.0);
        Student student3 = new Student("王五", '男', 97.0);
        studentList.add(student1);
        studentList.add(student2);
        studentList.add(student3);
    }

    //打印全班全部学生的信息
    public void printInfo() {
        studentOperator.printAllInfo(studentList);
    }
    //打印全班全部学生的平均分
    public void printScore() {
        studentOperator.printAverageScore(studentList);
    }
}
